package net.zhengxinyun.performance.App.service.DuCha;

import net.zhengxinyun.performance.App.entity.EcoIndexentity;
import net.zhengxinyun.performance.App.entity.PishiEntity;
import net.zhengxinyun.performance.App.entity.ZhongDianWorkEntity;
import net.zhengxinyun.performance.App.mapper.DuChaMapper;
import net.zhengxinyun.performance.Util.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DuchaServiceimpl implements DuchaService {
    @Autowired
    private DuChaMapper duChaMapper;

    // 重点工作
    @Override
    public List<ZhongDianWorkEntity> querywork(ZhongDianWorkEntity entity) {
        List<ZhongDianWorkEntity> queryworks = duChaMapper.querywork(entity);

        return queryworks;
    }

    /**
     * 新增重点工作
     *
     * @param entity
     * @return
     */
    @Override
    public int insertzhongdian(ZhongDianWorkEntity entity) {
        int i = duChaMapper.insertzhongdian(entity);
        return i;
    }

    /**
     * 删除重点工作
     *
     * @param id
     * @return
     */
    @Override
    public int deletezhongdian(long id) {
        int i = duChaMapper.deletezhongdian(id);
        return i;
    }

    /**
     * 修改
     *
     * @param entity
     * @return
     */
    @Override
    public int updatezhongdian(ZhongDianWorkEntity entity) {
        if (entity.getId() == null) {
            return 0;
        } else {
            int i = duChaMapper.updatezhongdian(entity);
            return i;
        }
    }

    @Override
    public ZhongDianWorkEntity getById(long id) {
        return duChaMapper.getById(id);
    }

    //批示
    @Override
    public List<PishiEntity> querypishi(PishiEntity entity) {
        List<PishiEntity> querypishis = duChaMapper.querypishi(entity);

        return querypishis;
    }

    @Override
    public int insertpishi(PishiEntity entity) {
        int i = duChaMapper.insertpishi(entity);
        return i;
    }

    @Override
    public int deletepishi(long id) {
        return duChaMapper.deletepishi(id);
    }

    @Override
    public int updatepishi(PishiEntity entity) {
        if (entity.getId() == null) {
            return 0;
        } else {
            return duChaMapper.updatepishi(entity);
        }
    }

    @Override
    public PishiEntity getByPiShiId(long id) {
        return null;
    }

    // 指标
    @Override
    public List<EcoIndexentity> queryEcoIndex(EcoIndexentity ecoIndexentity) {
        return duChaMapper.queryEcoIndex(ecoIndexentity);
    }

    @Override
    public int insertEcoIndex(EcoIndexentity entity) {
        return duChaMapper.insertEcoIndex(entity);
    }

    @Override
    public int deleteEcoIndex(long id) {
        return duChaMapper.deleteEcoIndex(id);
    }

    @Override
    public int updateEcoIndex(EcoIndexentity entity) {
        if (entity.getId() == null) {
            return 0;
        } else {
            return duChaMapper.updateEcoIndex(entity);
        }
    }

}
